package com.test.slice;

import com.ms.banner.Banner;
import com.ms.banner.BannerConfig;
import com.test.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;

import static com.test.MyApplication.getDataInt;
import static com.test.MyApplication.getDataStr;

public class BannerLocalAbilitySlice extends AbilitySlice {

    private Banner banner;

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_banner_local);
        banner = (Banner) findComponentById(ResourceTable.Id_banner);
        //简单使用
        banner.setBannerTitles(getDataStr())
                .setPages(getDataInt(), new CustomViewHolder())
                .setAutoPlay(true)
                .setDelayTime(3000)
                .setIndicatorGravity(BannerConfig.CENTER)
                .start();
    }
}